package com.web.test.utils;

import com.sun.xml.internal.ws.api.ha.StickyFeature;

/**
 * Created by Administrator on 2017/9/14.
 */
public class SQLUtils {

	//message 表
	public static String all  = "select * from message"; 
	public static String deleteAll  = "delete from message"; 
	
	public static String getFindByNameSql(String name) {

		return "select * from message WHERE NAME='" + name + "'";
	}

	public static String getFindByIdAndNameSql(String name,int id) {

		return "select * from message WHERE NAME='" + name + "' and id="+id ;
	}

	public static String getFindByAgeSql(int inputAge) {
		return "select * from message WHERE age=" + inputAge;
	}

	public static String getFindBySexSql(String inputSex) {
		return "select * from message WHERE sex='" + inputSex + "'";
	}

	public static String getFindByPhoneSql(String inputPhone) {
		return "select * from message WHERE phone='" + inputPhone + "'";
	}

	public static String getFindByAddressSql(String inputAddress) {
		return "select * from message WHERE address='" + inputAddress + "'";
	}

	public static String getUpdateByNameSql(String inputName, int id) {
		return "update message set name='" + inputName + "' where id=" + id;
	}

	public static String getUpdateByAgeSql(int inputAge, int id) {
		return "update message set age=" + inputAge + " where id=" + id;
	}

	public static String getUpdateBySexSql(String inputSex, int id) {
		return "update message set sex='" + inputSex + "' where id=" + id;
	}

	public static String getUpdateByPhoneSql(String inputPhone, int id) {
		return "update message set phone='" + inputPhone + "' where id=" + id;
	}

	public static String getUpdateByAddressSql(String inputAddress, int id) {
		return "update message set address='" + inputAddress + "' where id="
				+ id;
	}

	public static String getDeleteByIdSql(int id) {

		return "delete from message where id=" + id;
	}

	public static String getSortMessageBySql(String c) {

		return "select * from message order by "+c;
	}

	//empinformation表

	public static String empInfoAll = "select * from empinformation";

	//stu表

	public static String stuAll = "select * from stu";

	public static String getFindByStuNoAndPassSql(String no, String password) {

		return "select * from stu WHERE stu_no='" + no + "' and password='"+password+"'" ;
	}

	public static String getDeleteByStuNoSql(int no) {

		return "delete from stu where stu_no='" + no+"'";
	}

	//question表
	public static String questionAll = "select * from question";

	public static String onlySelectAll = "select * from question where type="+Constants.ONLY_SELECT_Q;
	public static String multiSelectAll = "select * from question where type="+Constants.MULTI_SELECT_Q;
	public static String judgeAll = "select * from question where type="+Constants.JUDGE_Q;
	public static String writeAll = "select * from question where type="+Constants.WRITE_Q;


}
